<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>用户的零售订单</title>

    <link rel="stylesheet" href="http://cdn.viptool.cn/lib/bootstrap/3.3.5/css/bootstrap.min.css">
    <link href="../../resource/hotui/css/font-awesome.min.css" th:href="@{/resource/hotui/css/font-awesome.min.css}"
          rel="stylesheet">
    <!-- Morris -->
    <link href="http://cdn.viptool.cn/lib/morris.js/0.4.3/morris.css" rel="stylesheet">
    <link href="../../resource/hotui/css/style.min-1.0.8.css" th:href="@{/resource/hotui/css/style.min-1.0.8.css}"
          rel="stylesheet">
    <link href="http://cdn.viptool.cn/lib/bootstrap-daterangepicker/2.1.25/daterangepicker.min.css" rel="stylesheet">
    <link href="../../resource/hotui/css/hotui.style.override.css"
          th:href="@{/resource/hotui/css/hotui.style.override.css}" rel="stylesheet"/>

</head>

<body>
<div class="wrapper wrapper-content tooltip-demo">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins m-b-none">
                <div class="ibox-title" style="vertical-align: bottom;height: 100px;"
                     th:replace="fragments/user_detail_tab::userDetailHeader">
                </div>
                <div class="tabs-container">
                    <ul class="nav nav-tabs"
                        th:replace="fragments/user_detail_tab::userDetailTab(${user.userId},5)">
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active">
                            <div class="panel-body">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-content" style="border-top: 0px;">
                                        <form id="searchForm" th:object="${condition}">
                                            <input type="hidden" id="pageIndex" name="pageIndex"
                                                   th:value="${pageIndex}"/>
                                            <input type="hidden" id="userId" name="userId" th:value="*{userId}"/>
                                            <div class="form-inline">
                                                <div class="form-group m-r-sm">
                                                    <label class=" control-label" for="orderId">订单号：</label>
                                                    <input type="text" class="form-control input-sm mb10"
                                                           id="orderId" th:value="*{orderId}" name="orderId"
                                                           placeholder="订单号" style="width: 156px;"/>
                                                </div>
                                                <div class="form-group m-r-sm">
                                                    <label class=" control-label" for="createTimePick">支付时间：</label>
                                                    <input readonly type="text"
                                                           class="form-control input-sm mb10 data-range-pick"
                                                           id="createTimePick" name="createTimePick"
                                                           start-element="#beginTime" end-element="#endTime"
                                                           placeholder="开始时间-结束时间" style="width: 377px;"/>
                                                    <input type="hidden" th:value="*{beginTime}" id="beginTime"
                                                           name="beginTime"/>
                                                    <input type="hidden" th:value="*{endTime}" id="endTime"
                                                           name="endTime"/>
                                                </div>
                                                <div class="form-group m-r-sm">
                                                    <button type="button" onclick="logHandler.search(1)"
                                                            class="btn btn-primary btn-sm m-b-none searchBtn">筛选
                                                    </button>
                                                    <button type="button" onclick="logHandler.searchAll()"
                                                            class="btn btn-primary btn-sm m-b-none">显示全部
                                                    </button>
                                                </div>
                                            </div>
                                        </form>
                                        <p style="height: 10px;"></p>
                                        <table class="table table-bordered table-hover table-center">
                                            <thead>
                                            <tr>
                                                <th>序号</th>
                                                <th>订单号</th>
                                                <th>商品</th>
                                                <th>订单金额</th>
                                                <th>支付时间</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr th:each="order,index:${orders}">
                                                <td th:text="${index.count}"></td>
                                                <td th:text="${order.orderId}"></td>
                                                <td>
                                                    <p style="width: 100%; height: 50px;" th:if="${order.orderItemPOS.size()>0}">
                                                        <!--商品-->
                                                        <img th:src="${@resourceService.get(order.orderItemPOS.get(0).goodsInfo.thumbnail).getURI()}" style="width: 50px; height: 50px; float: left; margin-left: 5px;" src=""/>
                                                        <span th:text="${order.orderItemPOS.get(0).goodsInfo.goodsName}" style="overflow: hidden; text-align: left; margin-left: 10px; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; width: 54%; float: left;">商品名称</span>
                                                        <span style="float: right; margin-top: 30px">X<span th:text="${order.orderItemPOS.get(0).num}">1</span></span>
                                                    </p>

                                                </td>
                                                <td th:text="${order.finalAmount}">100</td>
                                                <td th:text="${#temporals.format(order.createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        <p style="float: left; margin: 20px 0;">
                                            共<span th:text="${totalRecords}"></span>条记录，当前第<span th:text="${pageIndex}"></span>/<span th:text="${totalPages==0?1:totalPages}"></span>，每页20条记录
                                        </p>
                                        <ul style="float: right;" class="pagination pagination-split">
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="http://cdn.viptool.cn/lib/jquery/2.2.4/jquery.min.js"></script>
<script src="http://cdn.viptool.cn/lib/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-utils.js?20190316"
        th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-utils.js?20190316(123123)}"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-init.js?20190316"
        th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-init.js?20190316}"
></script>


<script src="../../resource/hotui/js/content.min.js" th:src="@{/resource/hotui/js/content.min.js}"></script>

<script src="http://cdn.viptool.cn/lib/moment.js/2.19.2/moment.min.js"></script>
<script src="../../resource/hotui/js/plugins/datetimepick/js/daterangepicker.js"
        th:src="@{/resource/hotui/js/plugins/datetimepick/js/daterangepicker.js}"></script>

<script type="text/javascript" th:inline="javascript">
    const pageIndex = /*[[${pageIndex}]]*/  1;
    const totalPages = /*[[${totalPages}]]*/  0;
    const pageUri = /*[[@{/user/detail/retailOrder}]]*/  "";
    const userId = /*[[${user.userId}]]*/ 0;
</script>

<script type="text/javascript">
    $(function () {
        //初始化分页
        var pageinate = new hot.paging(".pagination", pageIndex, totalPages, 7);

        pageinate.init(function (p) {
            logHandler.search(p)
        });
        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $(".searchBtn").trigger("click");
            }
        });

    });

    var logHandler = {
        search: function (pageIndex) {
            $("input[name=pageIndex]").val(pageIndex);

            $("#searchForm").submit();
        },
        searchAll: function () {
            window.location.href = pageUri + "?userId=" + userId;
        }
    }
</script>

</body>

</html>